import * as actionType from "./actionType.js"

const initState = {
    list: [],
    count: 0,
    user: {}
}

function reducer(state = initState, action) {
    switch (action.type) {
        case actionType.GETBEFORECREDIT:
            return {
                ...state,
                list: action.data,
                count: action.count

            }
        case actionType.LOGIN:
            return {
                ...state,
                user: {
                    ...action.data,
                }
            }
        case actionType.LOGOUT:
            return {
                ...state,
                user: {
                    ...action.data,
                    isLogin: false
                }
            }
        default:
            return state
    }
}
export default reducer